<template>
  <a-space>
    <a-popover placement="top" v-if="hasRefresh">
      <template slot="content">返回</template>
      <a @click="handleRefresh">
        <a-icon type="sync" />
      </a>
    </a-popover>
    <a-popover placement="top">
      <template slot="content">刷新</template>
      <a @click="handleGoBack">
        <a-icon type="rollback" />
      </a>
    </a-popover>
  </a-space>
</template>
<script>
export default {
  props: {
    hasRefresh: {
      type: Boolean,
      require: false,
      default: false,
    },
  },
  mounted() {
    if (this.hasRefresh) {
      this.hasRefresh = true;
    } else {
      this.hasRefresh = false;
    }
  },
  methods: {
    handleGoBack() {
      this.$emit("goBack");
    },
    handleRefresh() {
      this.$emit("refresh");
    },
  },
};
</script>
